package com.digitalart.siteBuilder.nav.item {
	
	import com.digitalart.commons.TextFormatter;      
	import flash.text.TextFormat;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextField;
	import flash.display.Sprite;
	
	/**
	 * @author ulises.ocana
	 */
	public class NavItem extends Sprite {
		
		private var _isSelected : Boolean;
		private var _textField : TextField;
		
		
		/**********************************Constructor*************************/
		
		public function NavItem(text : String) {
			textField = new TextField();
			textField.htmlText = text;
			TextFormatter.setTextFormat(textField);                 
			this.addChild(textField);                       
			addHitPoint();
		}
		
		/**********************************************************************/
		
		/**********************************Methods*************************/
		
		private function addHitPoint() : void {
			var hitPoint : Sprite = new Sprite();
			hitPoint.graphics.beginFill(0xFFFFFF);
			hitPoint.graphics.drawRect(0, 0, textField.width, textField.height);
			hitPoint.graphics.endFill();
			hitPoint.x = textField.x;
			hitPoint.y = textField.y;
			hitPoint.buttonMode = true;
			hitPoint.alpha = 0;
			addChild(hitPoint);
		}
		
		/**********************************************************************/
		/**************************Getters & Setters***************************/
		
		public function setTextColorSelected():void{
			textField.textColor = 0xfbdc5f;
		}
		
		public function setTextColorUnSelected():void{
			textField.textColor = 0xFFFFFF;
		}
		
		public function get isSelected() : Boolean {
			return _isSelected;
		}
		
		public function set isSelected(isSelected : Boolean) : void {
			_isSelected = isSelected;
		}
		
		public function get textField() : TextField {
			return _textField;
		}
		
		public function set textField(textField : TextField) : void {
			_textField = textField;
		}
	}
}
